/*
 * @Author: your name
 * @Date: 2021-04-21 19:15:19
 * @LastEditTime: 2021-04-23 15:38:04
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \fantasticit\src\store\modules\comment.ts
 */
// !!!留言板

import { makeAutoObservable } from "mobx"
import {getMsgcomment,getMsgcommentList} from "../../services/modules/comment"
//类型
import {IMsgcomment,IMsgcommentList} from "../../util/comment"
class Comment{
    msgcommentlist(msgcommentlist: any) {
      throw new Error('Method not implemented.');
    }
    constructor(){
        makeAutoObservable(this);
    }
    // 留言板的id
    getcommentId:any = [];
    //留言板列表
    getcommentList:IMsgcommentList[] = []
    //页数
    page = 1
    total = 0
   
    //获取留言板
    async getMsgcomment(){
        let result = await getMsgcomment();
        // debugger;
        if(result.statusCode == 200){
            this.getcommentId = result.data; 
        }
    }
    //获取留言板的列表
    async getMsgcommentList(id:any,page:number){
        // if (this.total && this.page * 6 >= this.total){
        //     return;
        // }
        let result = await getMsgcommentList(id,page);
        if (result.statusCode === 200){
            this.getcommentList = result.data[0]
            this.total = result.data[1];
            page++;
        }
    }
   

}

export default Comment;